package com.test.bendi.controller;

import com.test.bendi.annotation.LocalLock;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class testController {
    /**
     * http://localhost:8080/test?token=21   5秒内发两次会抛出异常请勿重复请求
     * @param token
     * @return
     */
    @LocalLock(key = "book:arg[0]")
    @GetMapping
    public String query(@RequestParam String token){
        return "success - "+token;
    }
}
